package dataModule

import "fmt"

// Animal 声明一个动物结构体
type Animal struct {
	Age  int
	Name string
}

func (a *Animal) Shout() {
	fmt.Printf("Animal %s shout\n", a.Name)
}

// Cat 声明一个cat, 继承Animal，扩展一个属性Color
type Cat struct {
	Animal
	color string
}

func (c *Cat) SetColor(color string) {
	c.color = color
}

func (c *Cat) Scratch() {
	fmt.Printf("cat %s scratch\n", c.Name)
}

func (c *Cat) String() string {
	return fmt.Sprintf("cat name =%s ; cat color = %s\n", c.Name, c.color)
}
